It create a Pod that uses a Secret to pull an image from a private container image registry or repository.
There are many private registries in use. This task uses "Docker Hub" as an example registry.

[Log in to Docker Hub]
$ docker login
Login with your Docker ID to push and pull images from Docker Hub.
Username: DOCKER_HUB_USER_ID
Password: DOCKER_HUB_USER_PASSWORD
WARNING! Your password will be stored unencrypted in /home/USER_NAME/.docker/config.json.
Login Succeeded

When it prompted, enter a Docker ID username and then the credential want to use 'access token' or 'password' for Docker ID.
The login process creates or updates a 'config.json' file that holds an authorization token.

$ cat ~/.docker/config.json
{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "c3R...zE2"
        }
    }
}

Kubernetes cluster uses the Secret of 'kubernetes.io/dockerconfigjson' type to authenticate with a container registry to pull a private image.

$ kubectl create secret generic regcred --from-file=.dockerconfigjson=<path/to/.docker/config.json> --type=kubernetes.io/dockerconfigjson

$ kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

where the following options are:
● <your-registry-server>
It is Private Docker Registry.
The use "https://index.docker.io/v1/" for DockerHub.
● <your-name>
It is Docker username.
● <your-pword>
It is Docker password.
● <your-email>
It is Docker email.

So viewing the Secret in YAML format.
$ kubectl get secret regcred --output=yaml
apiVersion: v1
kind: Secret
metadata:
  ...
  name: regcred
  ...
data:
  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
type: kubernetes.io/dockerconfigjson

The value of the ".dockerconfigjson"  field is a base64 of Docker credentials.
To understand what is in the ".dockerconfigjson" field, convert the secret data to a readable format.

$ kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
{"auths":{"your.private.registry.example.com":{"username":"janedoe","password":"xxxxxxxxxxx","email":"jdoe@example.com","auth":"c3R...zE2"}}}

To understand what is in the "auth" field in "~/.docker/config.json" (OR) "$HOME/.docker/config.json" (OR) "/home/USER_NAME/.docker/config.json", convert the base64-encoded data to a readable format.

$ cat ~/.docker/config.json
{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "c3R...zE2"
        }
    }
}

The output of username and password will be concatenated with a ':'.

$ echo "c3R...zE2" | base64 --decode
janedoe:xxxxxxxxxxx

[Create the Pod]
$ kubectl apply -f Pod_1.yaml
$ kubectl apply -f https://k8s.io/examples/pods/private-reg-pod.yaml
$ kubectl get pod private-reg
$ kubectl describe pod private-reg
